package open.intellijboy.framework.core.constant;

/**
 * 通用常量
 *
 * @author System
 * @version 1.0.0
 * @since 2024-01-01
 */
public abstract class CommonConstants {
    /**
     * 字符编码
     */
    public static final String UTF8 = "UTF-8";
    public static final String GBK = "GBK";

    /**
     * 日期时间格式
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd";
    public static final String TIME_FORMAT = "HH:mm:ss";
    public static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";

    /**
     * 分页相关
     */
    public static final int DEFAULT_PAGE_NUM = 1;
    public static final int DEFAULT_PAGE_SIZE = 10;
    public static final int MAX_PAGE_SIZE = 100;

    /**
     * 排序方向
     */
    public static final String ORDER_ASC = "ASC";
    public static final String ORDER_DESC = "DESC";

    /**
     * 逻辑删除标识
     */
    public static final int NOT_DELETED = 0;
    public static final int DELETED = 1;

    /**
     * 状态标识
     */
    public static final int STATUS_DISABLED = 0;
    public static final int STATUS_ENABLED = 1;

    /**
     * 用户状态
     */
    public static final int USER_STATUS_ACTIVE = 1;
    public static final int USER_STATUS_INACTIVE = 0;
    public static final int USER_STATUS_LOCKED = -1;

    /**
     * 密码相关
     */
    public static final int PASSWORD_MIN_LENGTH = 6;
    public static final int PASSWORD_MAX_LENGTH = 20;
    public static final String PASSWORD_PATTERN = "^(?=.*[a-zA-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{6,20}$";

    /**
     * 手机号正则
     */
    public static final String PHONE_PATTERN = "^1[3-9]\\d{9}$";

    /**
     * 邮箱正则
     */
    public static final String EMAIL_PATTERN = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";

    /**
     * 身份证号正则
     */
    public static final String ID_CARD_PATTERN = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";

    /**
     * 文件相关
     */
    public static final String[] ALLOWED_IMAGE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "webp"};
    public static final String[] ALLOWED_DOCUMENT_TYPES = {"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"};
    public static final long MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB

    /**
     * 缓存相关
     */
    public static final String CACHE_PREFIX = "scenic:reservation:";
    public static final int CACHE_DEFAULT_EXPIRE = 3600; // 1小时
    public static final int CACHE_USER_EXPIRE = 1800; // 30分钟
    public static final int CACHE_VERIFICATION_EXPIRE = 300; // 5分钟

    /**
     * JWT相关
     */
    public static final String JWT_HEADER = "Authorization";
    public static final String JWT_PREFIX = "Bearer ";
    public static final long JWT_EXPIRE_TIME = 7 * 24 * 60 * 60 * 1000L; // 7天

    /**
     * 请求头相关
     */
    public static final String TRACE_ID_HEADER = "X-Trace-Id";
    public static final String USER_ID_HEADER = "X-User-Id";
    public static final String CLIENT_IP_HEADER = "X-Forwarded-For";

    /**
     * 系统相关
     */
    public static final String SYSTEM_NAME = "Scenic Reservation System";
    public static final String SYSTEM_VERSION = "1.0.0";
    public static final String DEFAULT_ADMIN = "admin";
    public static final String DEFAULT_PASSWORD = "123456";

    /**
     * 业务相关
     */
    public static final int MAX_RESERVATION_DAYS = 30; // 最大预约天数
    public static final int MIN_RESERVATION_HOURS = 2; // 最小预约提前小时数
    public static final int MAX_CANCELLATION_HOURS = 24; // 最大取消提前小时数
}